package com.nwpu.am.validation;

import com.nwpu.am.annotation.Role;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * RoleValidation
 *
 * @author Roy
 * @version 1.0
 * {@code @date} 2024/6/5
 */

public class RoleValidation implements ConstraintValidator<Role, Short> {

    @Override
    public boolean isValid(Short s, ConstraintValidatorContext constraintValidatorContext) {
        return (s == null || (s >= 0 && s <= 1));
    }
}
